# -*- coding: utf-8 -*-
# @Time : 2022-01-17 18:11
# @Author : Z
# @Function :

from Keywords.inter_keys import Inter

inter = Inter()

# ll = inter.add_headers("app=weather.today&weaid=1&appkey=10003")
# print(ll)
# ll = inter.add_headers('{"a":"1","b":"1","c":"2"}')
# print(ll)
inter.set_url('http://testingedu.com.cn:8081/inter/HTTP')
inter.post_data('/auth')
inter.assert_equals('$.msg', 'success')
inter.save_json('token', 'newtoken')
# ll = inter.add_headers('token={newtoken}')
# print(ll)
# ll = inter.add_headers('{"token":"{newtoken}"}')
# print(ll)
inter.add_header('token', '{newtoken}')
inter.post_data('/login', "username=Will&password=123456")
# inter.post_data('login', '{"username":"Will","password":"123456"}')
inter.save_json('userid', 'newid')
# inter.assertmysql("SELECT * FROM `userinfo` where username = 'Will';", "{newid}", 'id')
# inter.assertmysql("SELECT * FROM `userinfo` where username = '11';", "[]")
inter.assert_equals('msg', '恭喜您，登录成功')
inter.post_data('/logout')
inter.assert_equals('msg', '用户已退出登录')
#
# inter.get("http://v.juhe.cn/weather/index", '{"cityname":"南宁","key":"ad1e075937ec0720fd57e0c32630cb4f"}')
#
# inter.post_upload(
#     "http://testingedu.com.cn:8000/index.php/home/Uploadify/imageUp/savepath/head_pic/pictitle/banner/dir/images.html",
#     "test.png", "image/jpeg", 'id=WU_FILE_0&name=logo.png&type=image/jpeg')
#
# inter.assert_equals("$.state", "SUCCESS")
#
# inter.post_json("http://172.30.4.10:17078/print/print/printBack",
#                 '{"programmed" : "DYFA20201216160001","printData" : '
#                 '{"restaurantName" : "博智林机器人餐厅","printTitle" : "菜品小票",'
#                 '"orderId" : 1578888866,'
#                 '"orderTime" : "2020-03-18 18:25:30",'
#                 '"deviceNo" : 1001,'
#                 '"tableName" : "C01",'
#                 '"tableTypeName" : "6人桌",'
#                 '"rowNo" : "A0009",'
#                 '"peopleNum" : 4,'
#                 '"waitingNum" : 1,'
#                 '"storeAddress" : "碧乐时光店店3楼406铺",'
#                 '"storePhone" : "188-8888-8888",'
#                 '"takeTime" : "2020-04-09 13:01:30",'
#                 '"totalAmount" : 206.0,'
#                 '"actualAmount" : 188.0,'
#                 '"preferentialAmount" : "-18.0",'
#                 '"mealNo" : "A001","takeDeviceName" : "A001",'
#                 '"productName" : "红烧牛",'
#                 '"orderListData" :[{"productName" : "红烧牛","num" : 2,"price" : 19.0,"subtotal" : 38.0}]}}')
